home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 June / PCpro_2006_06.ISO / files / freeware / openvip.exe / {app} / Python-README.txt < prev    next >
Encoding:
Text File  |  2002-10-14  |  42.9 KB  |  1,016 lines

  1. This is Python version 2.2.2
  2. ============================
  3.  
  4. Copyright (c) 2001, 2002 Python Software Foundation.
  5. All rights reserved.
  6.  
  7. Copyright (c) 2000 BeOpen.com.
  8. All rights reserved.
  9.  
  10. Copyright (c) 1995-2001 Corporation for National Research Initiatives.
  11. All rights reserved.
  12.  
  13. Copyright (c) 1991-1995 Stichting Mathematisch Centrum.
  14. All rights reserved.
  15.  
  16.  
  17. License information
  18. -------------------
  19.  
  20. See the file "LICENSE" for information on the history of this
  21. software, terms & conditions for usage, and a DISCLAIMER OF ALL
  22. WARRANTIES.
  23.  
  24. This Python distribution contains no GNU General Public Licensed
  25. (GPLed) code so it may be used in proprietary projects just like prior
  26. Python distributions.  There are interfaces to some GNU code but these
  27. are entirely optional.
  28.  
  29. All trademarks referenced herein are property of their respective
  30. holders.
  31.  
  32.  
  33. What's new in this release?
  34. ---------------------------
  35.  
  36. See the file "Misc/NEWS".
  37.  
  38. If you don't read instructions
  39. ------------------------------
  40.  
  41. Congratulations on getting this far. :-)
  42.  
  43. To start building right away (on UNIX): type "./configure" in the
  44. current directory and when it finishes, type "make".  This creates an
  45. executable "./python"; to install in /usr/local, first do "su root"
  46. and then "make install".
  47.  
  48. The section `Build Instructions' below is still recommended reading,
  49. especially the part on customizing Modules/Setup.
  50.  
  51.  
  52. What is Python anyway?
  53. ----------------------
  54.  
  55. Python is an interpreted object-oriented programming language suitable
  56. (amongst other uses) for distributed application development,
  57. scripting, numeric computing and system testing.  Python is often
  58. compared to Tcl, Perl, Java, JavaScript, Visual Basic or Scheme.  To
  59. find out more about what Python can do for you, point your browser to
  60. http://www.python.org/.
  61.  
  62.  
  63. How do I learn Python?
  64. ----------------------
  65.  
  66. The official tutorial is still a good place to start; see
  67. http://www.python.org/doc/ for online and downloadable versions, as
  68. well as a list of other introductions, and reference documentation.
  69.  
  70. There's a quickly growing set of books on Python.  See
  71. http://www.python.org/psa/bookstore/ for a list.
  72.  
  73.  
  74. Documentation
  75. -------------
  76.  
  77. All documentation is provided online in a variety of formats.  In
  78. order of importance for new users: Tutorial, Library Reference,
  79. Language Reference, Extending & Embedding, and the Python/C API.  The
  80. Library Reference is especially of immense value since much of
  81. Python's power is described there, including the built-in data types
  82. and functions!
  83.  
  84. All documentation is also available online at the Python web site
  85. (http://www.python.org/doc/, see below).  It is available online for
  86. occasional reference, or can be downloaded in many formats for faster
  87. access.  The documentation is available in HTML, PostScript, PDF, and
  88. LaTeX formats; the LaTeX version is primarily for documentation
  89. authors, translators, and people with special formatting requirements.
  90.  
  91. The best documentation for the new (in Python 2.2) type/class unification
  92. features is Guido's tutorial introduction, at
  93.  
  94.     http://www.python.org/2.2/descrintro.html
  95.  
  96.  
  97. Web sites
  98. ---------
  99.  
  100. New Python releases and related technologies are published at
  101. http://www.python.org/.  Come visit us!
  102.  
  103. There's also a Python community web site at http://starship.python.net/.
  104.  
  105.  
  106. Newsgroups and Mailing Lists
  107. ----------------------------
  108.  
  109. Read comp.lang.python, a high-volume discussion newsgroup about
  110. Python, or comp.lang.python.announce, a low-volume moderated newsgroup
  111. for Python-related announcements.  These are also accessible as
  112. mailing lists: see http://www.python.org/psa/MailingLists.html for an
  113. overview of the many Python-related mailing lists.
  114.  
  115. Archives are accessible via Deja.com Usenet News: see
  116. http://www.deja.com/usenet.  The mailing lists are also archived, see
  117. http://www.python.org/psa/MailingLists.html for details.
  118.  
  119.  
  120. Bug reports
  121. -----------
  122.  
  123. To report or search for bugs, please use the Python Bug
  124. Tracker at http://sourceforge.net/bugs/?group_id=5470.
  125.  
  126.  
  127. Patches and contributions
  128. -------------------------
  129.  
  130. To submit a patch or other contribution, please use the Python Patch
  131. Manager at http://sourceforge.net/patch/?group_id=5470.  Guidelines
  132. for patch submission may be found at http://www.python.org/patches/.
  133.  
  134. If you have a proposal to change Python, it's best to submit a Python
  135. Enhancement Proposal (PEP) first.  All current PEPs, as well as
  136. guidelines for submitting a new PEP, are list at
  137. http://python.sourceforge.net/peps/.
  138.  
  139.  
  140. Questions
  141. ---------
  142.  
  143. For help, if you can't find it in the manuals or on the web site, it's
  144. best to post to the comp.lang.python or the Python mailing list (see
  145. above).  If you specifically don't want to involve the newsgroup or
  146. mailing list, send questions to help@python.org (a group of volunteers
  147. who answer questions as they can).  The newsgroup is the most
  148. efficient way to ask public questions.
  149.  
  150.  
  151. Build instructions
  152. ==================
  153.  
  154. Before you can build Python, you must first configure it.
  155. Fortunately, the configuration and build process has been automated
  156. for Unix and Linux installations, so all you usually have to do is
  157. type a few commands and sit back.  There are some platforms where
  158. things are not quite as smooth; see the platform specific notes below.
  159. If you want to build for multiple platforms sharing the same source
  160. tree, see the section on VPATH below.
  161.  
  162. Start by running the script "./configure", which determines your
  163. system configuration and creates the Makefile.  (It takes a minute or
  164. two -- please be patient!)  You may want to pass options to the
  165. configure script -- see the section below on configuration options and
  166. variables.  When it's done, you are ready to run make.
  167.  
  168. To build Python, you normally type "make" in the toplevel directory.
  169. If you have changed the configuration, the Makefile may have to be
  170. rebuilt.  In this case you may have to run make again to correctly
  171. build your desired target.  The interpreter executable is built in the
  172. top level directory.
  173.  
  174. Once you have built a Python interpreter, see the subsections below on
  175. testing and installation.  If you run into trouble, see the next
  176. section.
  177.  
  178. Previous versions of Python used a manual configuration process that
  179. involved editing the file Modules/Setup.  While this file still exists
  180. and manual configuration is still supported, it is rarely needed any
  181. more: almost all modules are automatically built as appropriate under
  182. guidance of the setup.py script, which is run by Make after the
  183. interpreter has been built.
  184.  
  185.  
  186. Troubleshooting
  187. ---------------
  188.  
  189. See also the platform specific notes in the next section.
  190.  
  191. If you run into other trouble, see section 3 of the FAQ
  192. (http://www.python.org/cgi-bin/faqw.py or
  193. http://www.python.org/doc/FAQ.html) for hints on what can go wrong,
  194. and how to fix it.
  195.  
  196. If you rerun the configure script with different options, remove all
  197. object files by running "make clean" before rebuilding.  Believe it or
  198. not, "make clean" sometimes helps to clean up other inexplicable
  199. problems as well.  Try it before sending in a bug report!
  200.  
  201. If the configure script fails or doesn't seem to find things that
  202. should be there, inspect the config.log file.  When you fix a
  203. configure problem, be sure to remove config.cache!
  204.  
  205. If you get a warning for every file about the -Olimit option being no
  206. longer supported, you can ignore it.  There's no foolproof way to know
  207. whether this option is needed; all we can do is test whether it is
  208. accepted without error.  On some systems, e.g. older SGI compilers, it
  209. is essential for performance (specifically when compiling ceval.c,
  210. which has more basic blocks than the default limit of 1000).  If the
  211. warning bothers you, edit the Makefile to remove "-Olimit 1500" from
  212. the OPT variable.
  213.  
  214. If you get failures in test_long, or sys.maxint gets set to -1, you
  215. are probably experiencing compiler bugs, usually related to
  216. optimization.  This is a common problem with some versions of gcc and
  217. egcs, and some vendor-supplied compilers, which can sometimes be
  218. worked around by turning off optimization.  Consider switching to
  219. stable versions (gcc 2.7.2.3, egcs 1.1.2, or contact your vendor.)
  220.  
  221. From Python 2.0 onward, all Python C code is ANSI C.  Compiling using
  222. old K&R-C-only compilers is no longer possible.  ANSI C compilers are
  223. available for all modern systems, either in the form of updated
  224. compilers from the vendor, or one of the free compilers (gcc, egcs).
  225.  
  226. Platform specific notes
  227. -----------------------
  228.  
  229. (Some of these may no longer apply.  If you find you can build Python
  230. on these platforms without the special directions mentioned here,
  231. submit a documentation bug report to SourceForge (see Bug Reports
  232. above) so we can remove them!)
  233.  
  234. 64-bit platforms: The modules audioop, imageop and rgbimg don't work.
  235.     The setup.py script disables them on 64-bit installations.
  236.     Don't try to enable them in the Modules/Setup file.  They
  237.     contain code that is quite wordsize sensitive.  (If you have a
  238.     fix, let us know!)
  239.  
  240. Solaris: When using Sun's C compiler with threads, at least on Solaris
  241.     2.5.1, you need to add the "-mt" compiler option (the simplest
  242.     way is probably to specify the compiler with this option as
  243.     the "CC" environment variable when running the configure
  244.     script).
  245.  
  246.         When using GCC on Solaris, beware of binutils 2.13 or GCC
  247.         versions built using it.  This mistakenly enables the
  248.         -zcombreloc option which creates broken shared libraries on
  249.         Solaris.  binutils 2.12 works, and the binutils maintainers
  250.         are aware of the problem, so binutils 2.13.1 will probably fix
  251.         this problem.
  252.  
  253. Linux:  A problem with threads and fork() was tracked down to a bug in
  254.     the pthreads code in glibc version 2.0.5; glibc version 2.0.7
  255.     solves the problem.  This causes the popen2 test to fail;
  256.     problem and solution reported by Pablo Bleyer.
  257.  
  258.     Under Linux systems using GNU libc 2 (aka libc6), the crypt
  259.     module now needs the -lcrypt option.  The setup.py script
  260.     takes care of this automatically.
  261.  
  262. Red Hat Linux: There's an executable /usr/bin/python which is Python
  263.     1.5.2 on most Red Hat installations; several key Red Hat tools
  264.     require this version.  Python 2.1.x may be installed as
  265.     /usr/bin/python2.  The Makefile installs Python as
  266.     /usr/local/bin/python, which may or may not take precedence
  267.     over /usr/bin/python, depending on how you have set up $PATH.
  268.  
  269. FreeBSD 3.x and probably platforms with NCurses that use libmytinfo or
  270.     similar: When using cursesmodule, the linking is not done in
  271.     the correct order with the defaults.  Remove "-ltermcap" from
  272.     the readline entry in Setup, and use as curses entry: "curses
  273.     cursesmodule.c -lmytinfo -lncurses -ltermcap" - "mytinfo" (so
  274.     called on FreeBSD) should be the name of the auxiliary library
  275.     required on your platform.  Normally, it would be linked
  276.     automatically, but not necessarily in the correct order.
  277.  
  278. BSDI:    BSDI versions before 4.1 have known problems with threads,
  279.     which can cause strange errors in a number of modules (for
  280.     instance, the 'test_signal' test script will hang forever.)
  281.     Turning off threads (with --with-threads=no) or upgrading to
  282.     BSDI 4.1 solves this problem.
  283.  
  284. DEC Unix: Run configure with --with-dec-threads, or with
  285.     --with-threads=no if no threads are desired (threads are on by
  286.     default).  When using GCC, it is possible to get an internal
  287.     compiler error if optimization is used.  This was reported for
  288.     GCC 2.7.2.3 on selectmodule.c.  Manually compile the affected
  289.     file without optimization to solve the problem.
  290.  
  291. DEC Ultrix: compile with GCC to avoid bugs in the native compiler,
  292.     and pass SHELL=/bin/sh5 to Make when installing.
  293.  
  294. AIX:    A complete overhaul of the shared library support is now in
  295.     place.  See Misc/AIX-NOTES for some notes on how it's done.
  296.     (The optimizer bug reported at this place in previous releases
  297.     has been worked around by a minimal code change.) If you get
  298.     errors about pthread_* functions, during compile or during
  299.     testing, try setting CC to a thread-safe (reentrant) compiler,
  300.     like "cc_r".  For full C++ module support, set CC="xlC_r" (or
  301.     CC="xlC" without thread support).
  302.  
  303. HP-UX:    Please read the file Misc/HPUX-NOTES for shared libraries.
  304.     When using threading, you may have to add -D_REENTRANT to the
  305.     OPT variable in the top-level Makefile; reported by Pat Knight,
  306.     this seems to make a difference (at least for HP-UX 10.20)
  307.     even though config.h defines it.
  308.  
  309. Minix:  When using ack, use "CC=cc AR=aal RANLIB=: ./configure"!
  310.  
  311. SCO:    The following apply to SCO 3 only; Python builds out of the box
  312.     on SCO 5 (or so we've heard).
  313.  
  314.     1) Everything works much better if you add -U__STDC__ to the
  315.     defs.  This is because all the SCO header files are broken.
  316.     Anything that isn't mentioned in the C standard is
  317.     conditionally excluded when __STDC__ is defined.
  318.  
  319.     2) Due to the U.S. export restrictions, SCO broke the crypt
  320.     stuff out into a separate library, libcrypt_i.a so the LIBS
  321.     needed be set to:
  322.  
  323.         LIBS=' -lsocket -lcrypt_i'
  324.  
  325. UnixWare: There are known bugs in the math library of the system, as well as
  326.         problems in the handling of threads (calling fork in one
  327.         thread may interrupt system calls in others). Therefore, test_math and
  328.         tests involving threads will fail until those problems are fixed.
  329.  
  330. SunOS 4.x: When using the SunPro C compiler, you may want to use the
  331.     '-Xa' option instead of '-Xc', to enable some needed non-ANSI
  332.     Sunisms.
  333.  
  334. NeXT:   Not supported anymore. Start with the MacOSX/Darwin code if you
  335.     want to revive it.
  336.  
  337. QNX:    Chris Herborth (chrish@qnx.com) writes:
  338.     configure works best if you use GNU bash; a port is available on
  339.     ftp.qnx.com in /usr/free.  I used the following process to build,
  340.     test and install Python 1.5.x under QNX:
  341.  
  342.     1) CONFIG_SHELL=/usr/local/bin/bash CC=cc RANLIB=: \
  343.         ./configure --verbose --without-gcc --with-libm=""
  344.  
  345.     2) edit Modules/Setup to activate everything that makes sense for
  346.        your system... tested here at QNX with the following modules:
  347.  
  348.         array, audioop, binascii, cPickle, cStringIO, cmath,
  349.         crypt, curses, errno, fcntl, gdbm, grp, imageop,
  350.         _locale, math, md5, new, operator, parser, pcre,
  351.         posix, pwd, readline, regex, reop, rgbimg, rotor,
  352.         select, signal, socket, soundex, strop, struct,
  353.         syslog, termios, time, timing, zlib, audioop, imageop, rgbimg
  354.  
  355.     3) make SHELL=/usr/local/bin/bash
  356.  
  357.        or, if you feel the need for speed:
  358.  
  359.        make SHELL=/usr/local/bin/bash OPT="-5 -Oil+nrt"
  360.  
  361.     4) make SHELL=/usr/local/bin/bash test
  362.  
  363.        Using GNU readline 2.2 seems to behave strangely, but I
  364.        think that's a problem with my readline 2.2 port.  :-\
  365.  
  366.     5) make SHELL=/usr/local/bin/bash install
  367.  
  368.     If you get SIGSEGVs while running Python (I haven't yet, but
  369.     I've only run small programs and the test cases), you're
  370.     probably running out of stack; the default 32k could be a
  371.     little tight.  To increase the stack size, edit the Makefile
  372.     to read: LDFLAGS = -N 48k
  373.  
  374. BeOS:    Chris Herborth (chrish@qnx.com) writes:
  375.     See BeOS/README for notes about compiling/installing Python on
  376.     BeOS R3 or later.  Note that only the PowerPC platform is
  377.     supported for R3; both PowerPC and x86 are supported for R4.
  378.  
  379. Cray T3E: Mark Hadfield (m.hadfield@niwa.co.nz) writes:
  380.     Python can be built satisfactorily on a Cray T3E but based on
  381.     my experience with the NIWA T3E (2002-05-22, version 2.2.1)
  382.     there are a few bugs and gotchas. For more information see a
  383.     thread on comp.lang.python in May 2002 entitled "Building
  384.     Python on Cray T3E".
  385.  
  386.         1) Use Cray's cc and not gcc. The latter was reported not to
  387.            work by Konrad Hinsen. It may work now, but it may not.
  388.  
  389.         2) To set sys.platform to something sensible, pass the
  390.            following environment variable to the configure script:
  391.  
  392.              MACHDEP=unicosmk
  393.  
  394.     2) Run configure with option "--enable-unicode=ucs4".
  395.  
  396.     3) The Cray T3E does not support dynamic linking, so extension
  397.        modules have to be built by adding (or uncommenting) lines
  398.        in Modules/Setup. The minimum set of modules is
  399.  
  400.          posix, new, _sre, unicodedata
  401.  
  402.        On NIWA's vanilla T3E system the following have also been
  403.        included successfully:
  404.  
  405.          _codecs, _locale, _socket, _symtable, _testcapi, _weakref
  406.          array, binascii, cmath, cPickle, crypt, cStringIO, dbm
  407.          errno, fcntl, grp, math, md5, operator, parser, pcre, pwd
  408.          regex, rotor, select, struct, strop, syslog, termios
  409.          time, timing, xreadlines
  410.  
  411.     4) Once the python executable and library have been built, make
  412.        will execute setup.py, which will attempt to build remaining
  413.        extensions and link them dynamically. Each of these attempts
  414.        will fail but should not halt the make process. This is
  415.        normal.
  416.  
  417.     5) Running "make test" uses a lot of resources and causes
  418.        problems on our system. You might want to try running tests
  419.        singly or in small groups.
  420.  
  421. SGI:    SGI's standard "make" utility (/bin/make or /usr/bin/make)
  422.     does not check whether a command actually changed the file it
  423.     is supposed to build.  This means that whenever you say "make"
  424.     it will redo the link step.  The remedy is to use SGI's much
  425.     smarter "smake" utility (/usr/sbin/smake), or GNU make.  If
  426.     you set the first line of the Makefile to #!/usr/sbin/smake
  427.     smake will be invoked by make (likewise for GNU make).
  428.  
  429.     WARNING: There are bugs in the optimizer of some versions of
  430.     SGI's compilers that can cause bus errors or other strange
  431.     behavior, especially on numerical operations.  To avoid this,
  432.     try building with "make OPT=".
  433.  
  434. OS/2:   If you are running Warp3 or Warp4 and have IBM's VisualAge C/C++
  435.         compiler installed, just change into the pc\os2vacpp directory
  436.         and type NMAKE.  Threading and sockets are supported by default
  437.         in the resulting binaries of PYTHON15.DLL and PYTHON.EXE.
  438.  
  439. Monterey (64-bit AIX): The current Monterey C compiler (Visual Age)
  440.         uses the OBJECT_MODE={32|64} environment variable to set the
  441.         compilation mode to either 32-bit or 64-bit (32-bit mode is
  442.         the default).  Presumably you want 64-bit compilation mode for
  443.         this 64-bit OS.  As a result you must first set OBJECT_MODE=64
  444.         in your environment before configuring (./configure) or
  445.         building (make) Python on Monterey.
  446.  
  447. Reliant UNIX: The thread support does not compile on Reliant UNIX, and
  448.         there is a (minor) problem in the configure script for that
  449.         platform as well.  This should be resolved in time for a
  450.         future release.
  451.  
  452. MacOSX: The tests will crash on both 10.1 and 10.2 with SEGV in
  453.         test_re and test_sre due to the small default stack size.  If
  454.         you set the stack size to 2048 before doing a "make test" the
  455.         failure can be avoided.  If you're using the tcsh (the default
  456.         on OSX), or csh shells use "limit stacksize 2048" and for the
  457.         bash shell, use "ulimit -s 2048".
  458.  
  459.         On naked Darwin you may want to add the configure option
  460.         "--disable-toolbox-glue" to disable the glue code for the Carbon
  461.         interface modules. The modules themselves are currently only built
  462.         if you add the --enable-framework option, see below.
  463.  
  464.         On a clean OSX /usr/local does not exist. Do a
  465.     "sudo mkdir -m 775 /usr/local"
  466.         before you do a make install. Alternatively, do "sudo make install"
  467.         which installs everything as superuser.
  468.  
  469.         You may want to try the configure option "--enable-framework"
  470.         which installs Python as a framework. The location can be set
  471.         as argument to the --enable-framework option (default
  472.         /Library/Frameworks). You may also want to check out ./Mac/OSX
  473.         for building a Python.app. You may also want to manually
  474.         install a symlink in /usr/local/bin/python to the executable
  475.         deep down in the framework.
  476.  
  477. Cygwin: With recent (relative to the time of writing, 2001-12-19)
  478.         Cygwin installations, there are problems with the interaction
  479.         of dynamic linking and fork().  This manifests itself in build
  480.         failures during the execution of setup.py.
  481.  
  482.         There are two workarounds that both enable Python (albeit
  483.         without threading support) to build and pass all tests on
  484.         NT/2000 (and most likely XP as well, though reports of testing
  485.         on XP would be appreciated).
  486.  
  487.         The workarounds:
  488.  
  489.         (a) the band-aid fix is to link the _socket module statically
  490.         rather than dynamically (which is the default).
  491.  
  492.         To do this, run "./configure --with-threads=no" including any
  493.         other options you need (--prefix, etc.).  Then in Modules/Setup
  494.          uncomment the lines:
  495.  
  496.         #SSL=/usr/local/ssl
  497.         #_socket socketmodule.c \
  498.         #    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
  499.         #    -L$(SSL)/lib -lssl -lcrypto
  500.  
  501.         and remove "local/" from the SSL variable.  Finally, just run
  502.         "make"!
  503.  
  504.         (b) The "proper" fix is to rebase the Cygwin DLLs to prevent
  505.         base address conflicts.  Details on how to do this can be
  506.         found in the following mail:
  507.  
  508.            http://sources.redhat.com/ml/cygwin/2001-12/msg00894.html
  509.  
  510.         It is hoped that a version of this solution will be
  511.         incorporated into the Cygwin distribution fairly soon.
  512.  
  513.         Two additional problems:
  514.  
  515.         (1) Threading support should still be disabled due to a known
  516.         bug in Cygwin pthreads that causes test_threadedtempfile to
  517.         hang.
  518.  
  519.         (2) The _curses module does not build.  This is a known
  520.         Cygwin ncurses problem that should be resolved the next time
  521.         that this package is released.
  522.  
  523.         On older versions of Cygwin, test_poll may hang and test_strftime
  524.         may fail.
  525.  
  526.         The situation on 9X/Me is not accurately known at present.
  527.         Some time ago, there were reports that the following
  528.         regression tests failed:
  529.  
  530.             test_pwd
  531.             test_select (hang)
  532.             test_socket
  533.  
  534.         Due to the test_select hang on 9X/Me, one should run the
  535.         regression test using the following:
  536.  
  537.             make TESTOPTS='-l -x test_select' test
  538.  
  539.         News regarding these platforms with more recent Cygwin
  540.         versions would be appreciated!
  541.  
  542. Configuring threads
  543. -------------------
  544.  
  545. As of Python 2.0, threads are enabled by default.  If you wish to
  546. compile without threads, or if your thread support is broken, pass the
  547. --with-threads=no switch to configure.  Unfortunately, on some
  548. platforms, additional compiler and/or linker options are required for
  549. threads to work properly.  Below is a table of those options,
  550. collected by Bill Janssen.  We would love to automate this process
  551. more, but the information below is not enough to write a patch for the
  552. configure.in file, so manual intervention is required.  If you patch
  553. the configure.in file and are confident that the patch works, please
  554. send in the patch.  (Don't bother patching the configure script itself
  555. -- it is regenerated each the configure.in file changes.)
  556.  
  557. Compiler switches for threads
  558. .............................
  559.  
  560. The definition of _REENTRANT should be configured automatically, if
  561. that does not work on your system, or if _REENTRANT is defined
  562. incorrectly, please report that as a bug.
  563.  
  564.     OS/Compiler/threads                     Switches for use with threads
  565.     (POSIX is draft 10, DCE is draft 4)     compile & link
  566.  
  567.     SunOS 5.{1-5}/{gcc,SunPro cc}/solaris   -mt
  568.     SunOS 5.5/{gcc,SunPro cc}/POSIX         (nothing)
  569.     DEC OSF/1 3.x/cc/DCE                    -threads
  570.         (butenhof@zko.dec.com)
  571.     Digital UNIX 4.x/cc/DCE                 -threads
  572.         (butenhof@zko.dec.com)
  573.     Digital UNIX 4.x/cc/POSIX               -pthread
  574.         (butenhof@zko.dec.com)
  575.     AIX 4.1.4/cc_r/d7                       (nothing)
  576.         (buhrt@iquest.net)
  577.     AIX 4.1.4/cc_r4/DCE                     (nothing)
  578.         (buhrt@iquest.net)
  579.     IRIX 6.2/cc/POSIX                       (nothing)
  580.         (robertl@cwi.nl)
  581.  
  582.  
  583. Linker (ld) libraries and flags for threads
  584. ...........................................
  585.  
  586.     OS/threads                          Libraries/switches for use with threads
  587.  
  588.     SunOS 5.{1-5}/solaris               -lthread
  589.     SunOS 5.5/POSIX                     -lpthread
  590.     DEC OSF/1 3.x/DCE                   -lpthreads -lmach -lc_r -lc
  591.         (butenhof@zko.dec.com)
  592.     Digital UNIX 4.x/DCE                -lpthreads -lpthread -lmach -lexc -lc
  593.         (butenhof@zko.dec.com)
  594.     Digital UNIX 4.x/POSIX              -lpthread -lmach -lexc -lc
  595.         (butenhof@zko.dec.com)
  596.     AIX 4.1.4/{draft7,DCE}              (nothing)
  597.         (buhrt@iquest.net)
  598.     IRIX 6.2/POSIX                      -lpthread
  599.         (jph@emilia.engr.sgi.com)
  600.  
  601.  
  602. Configuring additional built-in modules
  603. ---------------------------------------
  604.  
  605. Starting with Python 2.1, the setup.py script at the top of the source
  606. distribution attempts to detect which modules can be built and
  607. automatically compiles them.  Autodetection doesn't always work, so
  608. you can still customize the configuration by editing the Modules/Setup
  609. file; but this should be considered a last resort.  The rest of this
  610. section only applies if you decide to edit the Modules/Setup file.
  611. You also need this to enable static linking of certain modules (which
  612. is needed to enable profiling on some systems).
  613.  
  614. This file is initially copied from Setup.dist by the configure script;
  615. if it does not exist yet, create it by copying Modules/Setup.dist
  616. yourself (configure will never overwrite it).  Never edit Setup.dist
  617. -- always edit Setup or Setup.local (see below).  Read the comments in
  618. the file for information on what kind of edits are allowed.  When you
  619. have edited Setup in the Modules directory, the interpreter will
  620. automatically be rebuilt the next time you run make (in the toplevel
  621. directory).
  622.  
  623. Many useful modules can be built on any Unix system, but some optional
  624. modules can't be reliably autodetected.  Often the quickest way to
  625. determine whether a particular module works or not is to see if it
  626. will build: enable it in Setup, then if you get compilation or link
  627. errors, disable it -- you're either missing support or need to adjust
  628. the compilation and linking parameters for that module.
  629.  
  630. On SGI IRIX, there are modules that interface to many SGI specific
  631. system libraries, e.g. the GL library and the audio hardware.  These
  632. modules will not be built by the setup.py script.
  633.  
  634. In addition to the file Setup, you can also edit the file Setup.local.
  635. (the makesetup script processes both).  You may find it more
  636. convenient to edit Setup.local and leave Setup alone.  Then, when
  637. installing a new Python version, you can copy your old Setup.local
  638. file.
  639.  
  640.  
  641. Setting the optimization/debugging options
  642. ------------------------------------------
  643.  
  644. If you want or need to change the optimization/debugging options for
  645. the C compiler, assign to the OPT variable on the toplevel make
  646. command; e.g. "make OPT=-g" will build a debugging version of Python
  647. on most platforms.  The default is OPT=-O; a value for OPT in the
  648. environment when the configure script is run overrides this default
  649. (likewise for CC; and the initial value for LIBS is used as the base
  650. set of libraries to link with).
  651.  
  652. When compiling with GCC, the default value of OPT will also include
  653. the -Wall and -Wstrict-prototypes options.
  654.  
  655. Additional debugging code to help debug memory management problems can
  656. be enabled by using the --with-pydebug option to the configure script.
  657.  
  658.  
  659. Profiling
  660. ---------
  661.  
  662. If you want C profiling turned on, the easiest way is to run configure
  663. with the CC environment variable to the necessary compiler
  664. invocation.  For example, on Linux, this works for profiling using
  665. gprof(1):
  666.  
  667.     CC="gcc -pg" ./configure
  668.  
  669. Note that on Linux, gprof apparently does not work for shared
  670. libraries.  The Makefile/Setup mechanism can be used to compile and
  671. link most extension module statically.
  672.  
  673.  
  674. Testing
  675. -------
  676.  
  677. To test the interpreter, type "make test" in the top-level directory.
  678. This runs the test set twice (once with no compiled files, once with
  679. the compiled files left by the previous test run).  The test set
  680. produces some output.  You can generally ignore the messages about
  681. skipped tests due to optional features which can't be imported.
  682. If a message is printed about a failed test or a traceback or core
  683. dump is produced, something is wrong.  On some Linux systems (those
  684. that are not yet using glibc 6), test_strftime fails due to a
  685. non-standard implementation of strftime() in the C library. Please
  686. ignore this, or upgrade to glibc version 6.
  687.  
  688. IMPORTANT: If the tests fail and you decide to mail a bug report,
  689. *don't* include the output of "make test".  It is useless.  Run the
  690. failing test manually, as follows:
  691.  
  692.     ./python ./Lib/test/test_whatever.py
  693.  
  694. (substituting the top of the source tree for '.' if you built in a
  695. different directory).  This runs the test in verbose mode.
  696.  
  697.  
  698. Installing
  699. ----------
  700.  
  701. To install the Python binary, library modules, shared library modules
  702. (see below), include files, configuration files, and the manual page,
  703. just type
  704.  
  705.     make install
  706.  
  707. This will install all platform-independent files in subdirectories of
  708. the directory given with the --prefix option to configure or to the
  709. `prefix' Make variable (default /usr/local).  All binary and other
  710. platform-specific files will be installed in subdirectories if the
  711. directory given by --exec-prefix or the `exec_prefix' Make variable
  712. (defaults to the --prefix directory) is given.
  713.  
  714. All subdirectories created will have Python's version number in their
  715. name, e.g. the library modules are installed in
  716. "/usr/local/lib/python<version>/" by default, where <version> is the
  717. <major>.<minor> release number (e.g. "2.1").  The Python binary is
  718. installed as "python<version>" and a hard link named "python" is
  719. created.  The only file not installed with a version number in its
  720. name is the manual page, installed as "/usr/local/man/man1/python.1"
  721. by default.
  722.  
  723. If you have a previous installation of Python that you don't
  724. want to replace yet, use
  725.  
  726.     make altinstall
  727.  
  728. This installs the same set of files as "make install" except it
  729. doesn't create the hard link to "python<version>" named "python" and
  730. it doesn't install the manual page at all.
  731.  
  732. Alpha/beta revision levels are stripped from the executable and
  733. library filenames during installation. For example, Python2.1a2 will
  734. install as python2.1, overwriting the previous python2.1. To avoid
  735. this, you could set the Makefile VERSION variable manually
  736. (e.g. VERSION=2.1a2) before running "make install" or "make altinstall".
  737.  
  738. The only thing you may have to install manually is the Python mode for
  739. Emacs found in Misc/python-mode.el.  (But then again, more recent
  740. versions of Emacs may already have it.)  Follow the instructions that
  741. came with Emacs for installation of site-specific files.
  742.  
  743. On Mac OS X, if you have configured Python with --enable-framework, you
  744. should use "make frameworkinstall" to do the installation. Note that this
  745. installs the Python executable in a place that is not normally on your
  746. PATH, you may want to set up a symlink in /usr/local/bin.
  747.  
  748.  
  749. Configuration options and variables
  750. -----------------------------------
  751.  
  752. Some special cases are handled by passing options to the configure
  753. script.
  754.  
  755. WARNING: if you rerun the configure script with different options, you
  756. must run "make clean" before rebuilding.  Exceptions to this rule:
  757. after changing --prefix or --exec-prefix, all you need to do is remove
  758. Modules/getpath.o.
  759.  
  760. --with(out)-gcc: The configure script uses gcc (the GNU C compiler) if
  761.     it finds it.  If you don't want this, or if this compiler is
  762.     installed but broken on your platform, pass the option
  763.     --without-gcc.  You can also pass "CC=cc" (or whatever the
  764.     name of the proper C compiler is) in the environment, but the
  765.     advantage of using --without-gcc is that this option is
  766.     remembered by the config.status script for its --recheck
  767.     option.
  768.  
  769. --prefix, --exec-prefix: If you want to install the binaries and the
  770.     Python library somewhere else than in /usr/local/{bin,lib},
  771.     you can pass the option --prefix=DIRECTORY; the interpreter
  772.     binary will be installed as DIRECTORY/bin/python and the
  773.     library files as DIRECTORY/lib/python/*.  If you pass
  774.     --exec-prefix=DIRECTORY (as well) this overrides the
  775.     installation prefix for architecture-dependent files (like the
  776.     interpreter binary).  Note that --prefix=DIRECTORY also
  777.     affects the default module search path (sys.path), when
  778.     Modules/config.c is compiled.  Passing make the option
  779.     prefix=DIRECTORY (and/or exec_prefix=DIRECTORY) overrides the
  780.     prefix set at configuration time; this may be more convenient
  781.     than re-running the configure script if you change your mind
  782.     about the install prefix.
  783.  
  784. --with-readline: This option is no longer supported.  GNU
  785.     readline is automatically enabled by setup.py when present.
  786.  
  787. --with-threads: On most Unix systems, you can now use multiple
  788.     threads, and support for this is enabled by default.  To
  789.     disable this, pass --with-threads=no.  If the library required
  790.     for threads lives in a peculiar place, you can use
  791.     --with-thread=DIRECTORY.  IMPORTANT: run "make clean" after
  792.     changing (either enabling or disabling) this option, or you
  793.     will get link errors!  Note: for DEC Unix use
  794.     --with-dec-threads instead.
  795.  
  796. --with-sgi-dl: On SGI IRIX 4, dynamic loading of extension modules is
  797.     supported by the "dl" library by Jack Jansen, which is
  798.     ftp'able from ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
  799.     This is enabled (after you've ftp'ed and compiled the dl
  800.     library) by passing --with-sgi-dl=DIRECTORY where DIRECTORY
  801.     is the absolute pathname of the dl library.  (Don't bother on
  802.     IRIX 5, it already has dynamic linking using SunOS style
  803.     shared libraries.)  Support for this feature is deprecated.
  804.  
  805. --with-dl-dld: Dynamic loading of modules is rumored to be supported
  806.     on some other systems: VAX (Ultrix), Sun3 (SunOS 3.4), Sequent
  807.     Symmetry (Dynix), and Atari ST.  This is done using a
  808.     combination of the GNU dynamic loading package
  809.     (ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z) and an
  810.     emulation of the SGI dl library mentioned above (the emulation
  811.     can be found at
  812.     ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z).  To
  813.     enable this, ftp and compile both libraries, then call
  814.     configure, passing it the option
  815.     --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY where DL_DIRECTORY is
  816.     the absolute pathname of the dl emulation library and
  817.     DLD_DIRECTORY is the absolute pathname of the GNU dld library.
  818.     (Don't bother on SunOS 4 or 5, they already have dynamic
  819.     linking using shared libraries.)  Support for this feature is
  820.     deprecated.
  821.  
  822. --with-libm, --with-libc: It is possible to specify alternative
  823.     versions for the Math library (default -lm) and the C library
  824.     (default the empty string) using the options
  825.     --with-libm=STRING and --with-libc=STRING, respectively.  For
  826.     example, if your system requires that you pass -lc_s to the C
  827.     compiler to use the shared C library, you can pass
  828.     --with-libc=-lc_s. These libraries are passed after all other
  829.     libraries, the C library last.
  830.  
  831. --with-libs='libs': Add 'libs' to the LIBS that the python interpreter
  832.     is linked against.
  833.  
  834. --with-cxx=<compiler>: Some C++ compilers require that main() is
  835.         compiled with the C++ if there is any C++ code in the application.
  836.         Specifically, g++ on a.out systems may require that to support
  837.         construction of global objects. With this option, the main() function
  838.         of Python will be compiled with <compiler>; use that only if you
  839.         plan to use C++ extension modules, and if your compiler requires
  840.         compilation of main() as a C++ program.
  841.  
  842.  
  843. --with-pydebug:  Enable additional debugging code to help track down
  844.     memory management problems.  This allows printing a list of all
  845.     live objects when the interpreter terminates.
  846.  
  847.  
  848. Building for multiple architectures (using the VPATH feature)
  849. -------------------------------------------------------------
  850.  
  851. If your file system is shared between multiple architectures, it
  852. usually is not necessary to make copies of the sources for each
  853. architecture you want to support.  If the make program supports the
  854. VPATH feature, you can create an empty build directory for each
  855. architecture, and in each directory run the configure script (on the
  856. appropriate machine with the appropriate options).  This creates the
  857. necessary subdirectories and the Makefiles therein.  The Makefiles
  858. contain a line VPATH=... which points to a directory containing the
  859. actual sources.  (On SGI systems, use "smake -J1" instead of "make" if
  860. you use VPATH -- don't try gnumake.)
  861.  
  862. For example, the following is all you need to build a minimal Python
  863. in /usr/tmp/python (assuming ~guido/src/python is the toplevel
  864. directory and you want to build in /usr/tmp/python):
  865.  
  866.     $ mkdir /usr/tmp/python
  867.     $ cd /usr/tmp/python
  868.     $ ~guido/src/python/configure
  869.     [...]
  870.     $ make
  871.     [...]
  872.     $
  873.  
  874. Note that configure copies the original Setup file to the build
  875. directory if it finds no Setup file there.  This means that you can
  876. edit the Setup file for each architecture independently.  For this
  877. reason, subsequent changes to the original Setup file are not tracked
  878. automatically, as they might overwrite local changes.  To force a copy
  879. of a changed original Setup file, delete the target Setup file.  (The
  880. makesetup script supports multiple input files, so if you want to be
  881. fancy you can change the rules to create an empty Setup.local if it
  882. doesn't exist and run it with arguments $(srcdir)/Setup Setup.local;
  883. however this assumes that you only need to add modules.)
  884.  
  885.  
  886. Building on non-UNIX systems
  887. ----------------------------
  888.  
  889. For Windows (2000/NT/ME/98/95), assuming you have MS VC++ 6.0, the
  890. project files are in PCbuild, the workspace is pcbuild.dsw.  See
  891. PCbuild\readme.txt for detailed instructions.
  892.  
  893. For other non-Unix Windows compilers, in particular Windows 3.1 and
  894. for OS/2, enter the directory "PC" and read the file "readme.txt".
  895.  
  896. For the Mac, a separate source distribution will be made available,
  897. for use with the CodeWarrior compiler.  If you are interested in Mac
  898. development, join the PythonMac Special Interest Group
  899. (http://www.python.org/sigs/pythonmac-sig/, or send email to
  900. pythonmac-sig-request@python.org).
  901.  
  902. Of course, there are also binary distributions available for these
  903. platforms -- see http://www.python.org/.
  904.  
  905. To port Python to a new non-UNIX system, you will have to fake the
  906. effect of running the configure script manually (for Mac and PC, this
  907. has already been done for you).  A good start is to copy the file
  908. config.h.in to config.h and edit the latter to reflect the actual
  909. configuration of your system.  Most symbols must simply be defined as
  910. 1 only if the corresponding feature is present and can be left alone
  911. otherwise; however the *_t type symbols must be defined as some variant
  912. of int if they need to be defined at all.
  913.  
  914. For all platforms, it's important that the build arrange to define the
  915. preprocessor symbol NDEBUG on the compiler command line in a release
  916. build of Python (else assert() calls remain in the code, hurting
  917. release-build performance).  The Unix, Windows and Mac builds already
  918. do this.
  919.  
  920.  
  921. Miscellaneous issues
  922. ====================
  923.  
  924. Emacs mode
  925. ----------
  926.  
  927. There's an excellent Emacs editing mode for Python code; see the file
  928. Misc/python-mode.el.  Originally written by the famous Tim Peters, it
  929. is now maintained by the equally famous Barry Warsaw (it's no
  930. coincidence that they now both work on the same team).  The latest
  931. version, along with various other contributed Python-related Emacs
  932. goodies, is online at http://www.python.org/emacs/python-mode.  And
  933. if you are planning to edit the Python C code, please pick up the
  934. latest version of CC Mode http://www.python.org/emacs/cc-mode; it
  935. contains a "python" style used throughout most of the Python C source
  936. files.  (Newer versions of Emacs or XEmacs may already come with the
  937. latest version of python-mode.)
  938.  
  939.  
  940. Tkinter
  941. -------
  942.  
  943. The setup.py script automatically configures this when it detects a
  944. usable Tcl/Tk installation.  This requires Tcl/Tk version 8.0 or
  945. higher.
  946.  
  947. For more Tkinter information, see the Tkinter Resource page:
  948. http://www.python.org/topics/tkinter/
  949.  
  950. There are demos in the Demo/tkinter directory, in the subdirectories
  951. guido, matt and www (the matt and guido subdirectories have been
  952. overhauled to use more recent Tkinter coding conventions).
  953.  
  954. Note that there's a Python module called "Tkinter" (capital T) which
  955. lives in Lib/lib-tk/Tkinter.py, and a C module called "_tkinter"
  956. (lower case t and leading underscore) which lives in
  957. Modules/_tkinter.c.  Demos and normal Tk applications import only the
  958. Python Tkinter module -- only the latter imports the C _tkinter
  959. module.  In order to find the C _tkinter module, it must be compiled
  960. and linked into the Python interpreter -- the setup.py script does
  961. this.  In order to find the Python Tkinter module, sys.path must be
  962. set correctly -- normal installation takes care of this.
  963.  
  964.  
  965. Distribution structure
  966. ----------------------
  967.  
  968. Most subdirectories have their own README files.  Most files have
  969. comments.
  970.  
  971. .cvsignore    Additional filename matching patterns for CVS to ignore
  972. BeOS/        Files specific to the BeOS port
  973. Demo/           Demonstration scripts, modules and programs
  974. Doc/        Documentation sources (LaTeX)
  975. Grammar/        Input for the parser generator
  976. Include/        Public header files
  977. LICENSE        Licensing information
  978. Lib/            Python library modules
  979. Makefile.pre.in Source from which config.status creates the Makefile.pre
  980. Misc/           Miscellaneous useful files
  981. Modules/        Implementation of most built-in modules
  982. Objects/        Implementation of most built-in object types
  983. PC/             Files specific to PC ports (DOS, Windows, OS/2)
  984. PCbuild/    Build directory for Microsoft Visual C++
  985. Parser/         The parser and tokenizer and their input handling
  986. Python/         The byte-compiler and interpreter
  987. README          The file you're reading now
  988. Tools/          Some useful programs written in Python
  989. acconfig.h      Additional input for the GNU autoheader program
  990. config.h.in     Source from which config.h is created (GNU autoheader output)
  991. configure       Configuration shell script (GNU autoconf output)
  992. configure.in    Configuration specification (input for GNU autoconf)
  993. install-sh      Shell script used to install files
  994.  
  995. The following files will (may) be created in the toplevel directory by
  996. the configuration and build processes:
  997.  
  998. Makefile        Build rules
  999. Makefile.pre    Build rules before running Modules/makesetup
  1000. buildno        Keeps track of the build number
  1001. config.cache    Cache of configuration variables
  1002. config.h        Configuration header
  1003. config.log      Log from last configure run
  1004. config.status   Status from last run of the configure script
  1005. getbuildinfo.o    Object file from Modules/getbuildinfo.c
  1006. libpython<version>.a    The library archive
  1007. python          The executable interpreter
  1008. tags, TAGS      Tags files for vi and Emacs
  1009.  
  1010.  
  1011. That's all, folks!
  1012. ------------------
  1013.  
  1014.  
  1015. --Guido van Rossum (home page: http://www.python.org/~guido/)
  1016.